<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#49b1f5">
<meta name="generator" content="Hexo 5.3.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon-180x180-yaowan.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-yaowan.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-yaowan.png">
  <link rel="mask-icon" href="/images/logo-yaowan.svg" color="#49b1f5">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/pace-js@1/themes/blue/pace-theme-minimal.css">
  <script src="//cdn.jsdelivr.net/npm/pace-js@1/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"zhouyuqian.com","root":"/","scheme":"Mist","version":"7.7.2","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":"default","style":"flat"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":true,"color":"#49b1f5","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":"valine","storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":"ture"},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="Framebuffer 是用一个视频输出设备从包含完整的帧数据的一个内存缓冲区中来驱动一个视频显示设备。简单的来说，就是使用一个内存区来存储显示内容，改变内存的数据就可以改变显示的内容。 在 github 上有一个开源工程：framebuffer 完整的实现了 framebuffer驱动">
<meta property="og:type" content="article">
<meta property="og:title" content="ZYNQ 移植 Linux -- Frame Buffer">
<meta property="og:url" content="https://zhouyuqian.com/2020/05/11/ZYNQ-%E7%A7%BB%E6%A4%8D-Linux-Frame-Buffer/index.html">
<meta property="og:site_name" content="Fitz&#39;s Blog - 快乐学习每一天">
<meta property="og:description" content="Framebuffer 是用一个视频输出设备从包含完整的帧数据的一个内存缓冲区中来驱动一个视频显示设备。简单的来说，就是使用一个内存区来存储显示内容，改变内存的数据就可以改变显示的内容。 在 github 上有一个开源工程：framebuffer 完整的实现了 framebuffer驱动">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://pic.zhouyuqian.com/img/20210727233727.png">
<meta property="og:image" content="https://pic.zhouyuqian.com/img/20210727233728.png">
<meta property="og:image" content="https://pic.zhouyuqian.com/img/20210727233729.png">
<meta property="og:image" content="https://pic.zhouyuqian.com/img/20210727233730.png">
<meta property="og:image" content="https://pic.zhouyuqian.com/img/20210727233731.png">
<meta property="og:image" content="https://pic.zhouyuqian.com/img/20210727233732.png">
<meta property="article:published_time" content="2020-05-11T15:44:24.000Z">
<meta property="article:modified_time" content="2020-07-01T13:03:37.000Z">
<meta property="article:author" content="Fitz">
<meta property="article:tag" content="FPGA">
<meta property="article:tag" content="ZYNQ">
<meta property="article:tag" content="Linux">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://pic.zhouyuqian.com/img/20210727233727.png">

<link rel="canonical" href="https://zhouyuqian.com/2020/05/11/ZYNQ-%E7%A7%BB%E6%A4%8D-Linux-Frame-Buffer/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true
  };
</script>

  <title>ZYNQ 移植 Linux -- Frame Buffer | Fitz's Blog - 快乐学习每一天</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript><!-- hexo-inject:begin --><!-- hexo-inject:end -->

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Fitz's Blog - 快乐学习每一天</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-ariang">

    <a href="/AriaNg/" rel="section"><i class="fa fa-fw fa-cloud-download"></i>AriaNg</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>

</nav>
  <div class="site-search">
    <div class="popup search-popup">
    <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocorrect="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result"></div>

</div>
<div class="search-pop-overlay"></div>

  </div>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>
  <a role="button" class="book-mark-link book-mark-link-fixed"></a>

  <a href="https://github.com/Starrynightzyq" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://zhouyuqian.com/2020/05/11/ZYNQ-%E7%A7%BB%E6%A4%8D-Linux-Frame-Buffer/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="Fitz">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Fitz's Blog - 快乐学习每一天">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          ZYNQ 移植 Linux -- Frame Buffer
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-05-11 23:44:24" itemprop="dateCreated datePublished" datetime="2020-05-11T23:44:24+08:00">2020-05-11</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-07-01 21:03:37" itemprop="dateModified" datetime="2020-07-01T21:03:37+08:00">2020-07-01</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/ZYNQ-%E7%A7%BB%E6%A4%8D-Linux/" itemprop="url" rel="index"><span itemprop="name">ZYNQ 移植 Linux</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>5.1k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>5 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>Framebuffer 是用一个视频输出设备从包含完整的帧数据的一个内存缓冲区中来驱动一个视频显示设备。简单的来说，就是使用一个内存区来存储显示内容，改变内存的数据就可以改变显示的内容。 在 github 上有一个开源工程：<a target="_blank" rel="noopener" href="https://github.com/notro/fbtft">framebuffer</a> 完整的实现了 framebuffer驱动</p>
<a id="more"></a>
<blockquote>
<p>ref:</p>
<p>http://www.waveshare.net/wiki/1.3inch_LCD_HAT</p>
<p>https://krystof.io/mirroring-raspberry-pi-hdmi-video-to-a-st7789-1-3-inch-lcd-display/</p>
</blockquote>
<p>使用的屏幕分辨率 80*160，驱动芯片是 ST7735s，屏幕上除了 SPI 接口外，还有 RES、DC、BLK 三个接口</p>
<figure>
<img src="https://pic.zhouyuqian.com/img/20210727233727.png" alt="spi-oled"><figcaption aria-hidden="true">spi-oled</figcaption>
</figure>
<blockquote>
<p>注：与传统的SPI协议不同的地方是：由于是只需要显示，故而将从机发往主机的数据线进行了隐藏</p>
</blockquote>
<p>RESX：复位，模块上电时拉低，通常情况下置1； CSX：从机片选， 仅当CS为低电平时，芯片才会被使能。 D/CX：芯片的数据/命令控制引脚，当DC = 0时写命令，当DC = 1时写数据 SDA：传输的数据，即RGB数据； SCL：SPI通信时钟； 对于SPI通信而言，数据是有传输时序的，即时钟相位（CPHA）与时钟极性(CPOL)的组合： CPHA的高低决定串行同步时钟是在第一时钟跳变沿还是第二个时钟跳变沿数据被采集，当CPHL = 0，在第一个跳变沿进行数据采集； CPOL的高低决定串行同步时钟的空闲状态电平，CPOL = 0，为低电平。 从图中可以看出，当SCLK第一个下降沿时开始传输数据，一个时钟周期传输8bit数据，使用SPI0，按位传输,高位在前,低位在后。</p>
<h1 id="修改-vivado-工程">修改 Vivado 工程</h1>
<p>可以看出需要一个 SPI 接口和两个 GPIO 口，GPIO 口用来控制 RESX 和 D/CX 信号，BlockDesign 如图：</p>
<figure>
<img src="https://pic.zhouyuqian.com/img/20210727233728.png" alt="vivado-bd"><figcaption aria-hidden="true">vivado-bd</figcaption>
</figure>
<p>其实驱动可以用 zynq 的 EMIO 的，但是一直没驱动起来，就用了 AXI-GPIO</p>
<h1 id="重新生成-boot.bin">重新生成 BOOT.bin</h1>
<p>因为修改了 vivado 工程，所以需要使用新的 <em>bitstream</em> 文件重新生成 BOOT.bin，步骤参考 <a target="_blank" rel="noopener" href="https://blog.leo-fitz.com/2020/03/30/ZYNQ-%E7%A7%BB%E6%A4%8D-Linux/#%E5%88%9B%E5%BB%BA-BOOT-bin">ZYNQ 移植 Linux-创建 BOOT.bin</a></p>
<p># 修改 device-tree</p>
<p>在上一篇 <a target="_blank" rel="noopener" href="https://blog.leo-fitz.com/2020/05/05/ZYNQ-移植-Linux-SPI/">ZYNQ 移植 Linux -- SPI</a> 的基础上就增加了一个 AXI-GPIO，这部分的 dtc 可以直接使用 sdk 生成，无需修改，步骤参考 <a target="_blank" rel="noopener" href="https://blog.leo-fitz.com/2020/03/30/ZYNQ-%E7%A7%BB%E6%A4%8D-Linux/#%E5%88%9B%E5%BB%BA%E8%AE%BE%E5%A4%87%E6%A0%91%E6%96%87%E4%BB%B6">ZYNQ 移植 Linux-创建设备树文件</a></p>
<h1 id="配置内核">配置内核</h1>
<ol type="1">
<li><p>AXI-GPIO 配置</p>
<p>在上一篇 <a target="_blank" rel="noopener" href="https://blog.leo-fitz.com/2020/05/05/ZYNQ-移植-Linux-SPI/">ZYNQ 移植 Linux -- SPI</a> 的基础上需要启用 AXI-GPIO 的驱动，步骤参考 xilinx-wiki：</p>
<p><a target="_blank" rel="noopener" href="https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841846/AXI+GPIO">AXI GPIO</a></p>
<p>修改内核配置文件，启用如下配置：</p>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">CONFIG_GPIO_SYSFS</span>=y</span><br><span class="line"><span class="attr">CONFIG_SYSFS</span>=y</span><br><span class="line"><span class="attr">CONFIG_GPIO_XILINX</span>=y (for axi_gpio)</span><br></pre></td></tr></table></figure></li>
<li><p>fbtft 配置</p>
<p>打开配置菜单，在 <em>linux-xlnx/</em> 目录下运行：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">make menuconfig</span><br></pre></td></tr></table></figure>
<p>load 之前的配置文件：</p>
<figure>
<img src="https://pic.zhouyuqian.com/img/20210727233729.png" alt="menuconfig"><figcaption aria-hidden="true">menuconfig</figcaption>
</figure>
<p>启动 fbtft 驱动，路径：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">Device Drivers  ---&gt;</span><br><span class="line">true [*] Staging drivers  ---&gt;</span><br><span class="line">true 	&lt;*&gt;   Support <span class="keyword">for</span> small TFT LCD display modules  ---&gt;</span><br><span class="line">true 		&lt;M&gt;   FB driver <span class="keyword">for</span> the ST7735R LCD Controller <span class="comment"># st7735 芯片对应的驱动</span></span><br><span class="line">true 		&lt;M&gt;   Module to <span class="keyword">for</span> adding FBTFT devices       <span class="comment"># fbtft_device 驱动</span></span><br></pre></td></tr></table></figure>
<figure>
<img src="https://pic.zhouyuqian.com/img/20210727233730.png" alt="fbtft-configure"><figcaption aria-hidden="true">fbtft-configure</figcaption>
</figure>
<blockquote>
<p>注意这里至少需要选择两个驱动，一个是 fbtft_device，一个是屏幕芯片对应的驱动，如果这里没有所使用的屏幕芯片的驱动，可以选择 <code>Generic FB driver for TFT LCD displays</code> 通用驱动，不过用起来稍微有点烦，需要 init 参数。</p>
<p>选中的那个地方是 <code>&lt;M&gt;</code>，这样可以为这些驱动单独生成 <em>.ko</em> 驱动文件，方便调试</p>
</blockquote>
<p>保存后，编译内核：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">make xilinx_zynq_defconfig</span><br><span class="line">make -j8</span><br><span class="line">make UIMAGE_LOADADDR=0x8000 uImage -j8</span><br></pre></td></tr></table></figure>
<p>其中在第二个命令输出的 log 中会说生成的 <em>.ko</em> 文件的位置，将生成的内核 uImage 拷贝到内存卡，<em>.ko</em> 文件拷贝到 U盘 中。</p></li>
</ol>
<h1 id="加载驱动">加载驱动</h1>
<p>使用新的 <em>devicetree.dtb, uImage, BOOT.bin</em> 启动后，可以在 <em>/dev</em> 目录下看到 gpio 设备和 spi 设备，</p>
<h2 id="测试-gpio">测试 GPIO</h2>
<p>先测试下 gpio 是否工作正常，步骤可以参考 <a target="_blank" rel="noopener" href="https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841846/AXI+GPIO">xilinx-wiki -- AXI GPIO</a></p>
<p>在 <em>/sys/class/gpio</em> 目录下执行 <code>ls -all</code> 命令可以看到 gpio 设备的信息：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">xilinx@pynq:/sys/class/gpio$ ls -all</span><br><span class="line">total 0</span><br><span class="line">drwxr-xr-x  2 root root    0 May 11 15:11 .</span><br><span class="line">drwxr-xr-x 48 root root    0 Jan 28  2018 ..</span><br><span class="line">--w-------  1 root root 4096 May 11 15:11 <span class="built_in">export</span></span><br><span class="line">lrwxrwxrwx  1 root root    0 May 11 15:11 gpiochip1014 -&gt; ../../devices/soc0/amba_pl/41210000.gpio/gpio/gpiochip1014</span><br><span class="line">lrwxrwxrwx  1 root root    0 May 11 15:11 gpiochip1016 -&gt; ../../devices/soc0/amba_pl/41200000.gpio/gpio/gpiochip1016</span><br><span class="line">lrwxrwxrwx  1 root root    0 May 11 15:11 gpiochip1020 -&gt; ../../devices/soc0/amba_pl/41200000.gpio/gpio/gpiochip1020</span><br><span class="line">lrwxrwxrwx  1 root root    0 May 11 15:11 gpiochip896 -&gt; ../../devices/soc0/amba/e000a000.gpio/gpio/gpiochip896</span><br><span class="line">--w-------  1 root root 4096 May 11 15:11 unexport</span><br></pre></td></tr></table></figure>
<p>我的 DC 和 RST 引脚是接在了 <em>gpiochip1014</em> 上了，这里 gpio 的编号是怎么来的还没完全搞明白，不过可以通过 gpio 设备的地址来确定</p>
<p>接下来对 gpio 的电平，测一下 fpga 管脚上的电平是不是按预期的变化，在 <em>/sys/class/gpio</em> 目录下执行：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">echo</span> 1014 &gt; <span class="built_in">export</span> <span class="comment"># gpiochip1014 的第一个管脚</span></span><br><span class="line"><span class="built_in">echo</span> 1015 &gt; <span class="built_in">export</span> <span class="comment"># gpiochip1014 的第二个管脚</span></span><br><span class="line"><span class="comment"># 这时在 /sys/class/gpio 目录下应该会产生 gpio1014 gpio1015 两个目录</span></span><br><span class="line"><span class="built_in">echo</span> out &gt; gpio1014/direction <span class="comment"># 设置 gpio 方向为输出</span></span><br><span class="line"><span class="built_in">echo</span> out &gt; gpio1015/direction</span><br><span class="line"><span class="built_in">echo</span> 1 &gt; gpio1014/value <span class="comment"># 在第一个管脚上输出高电平</span></span><br><span class="line"><span class="built_in">echo</span> 1 &gt; gpio1015/value <span class="comment"># 在第二个管脚上输出高电平</span></span><br><span class="line"><span class="built_in">echo</span> 0 &gt; gpio1014/value <span class="comment"># 在第一个管脚上输出低电平</span></span><br><span class="line"><span class="built_in">echo</span> 0 &gt; gpio1015/value <span class="comment"># 在第二个管脚上输出低电平</span></span><br></pre></td></tr></table></figure>
<p>接在 DC 和 RST 上的两个 gpio 管脚应该会按预期输出电平</p>
<h2 id="加载-fbtft-驱动">加载 fbtft 驱动</h2>
<p><em>.ko</em> 文件放在了 U盘里，首先将 U盘 挂载上，然后进入 <em>.ko</em> 文件所在位置，如何在 zynq 上挂载 U盘 可以参考 <a target="_blank" rel="noopener" href="https://blog.leo-fitz.com/2020/04/13/ZYNQ-移植-Linux-USB/">ZYNQ 移植 Linux -- USB</a></p>
<p>使用如下命令加载驱动：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo insmod fbtft_device.ko name=adafruit18 busnum=1 gpios=<span class="string">&quot;reset:1014,dc:1015&quot;</span> rotate=90 custom=1 height=160 width=80</span><br><span class="line">sudo insmod fb_st7735r.ko</span><br></pre></td></tr></table></figure>
<p>如果成功了屏幕应该就会有显示了，在 <em>/dev</em> 目录下会产生 <em>fb0</em> 设备，不成功可以用 <code>dmesg</code> 命令查看内核 log，看下报错信息。</p>
<p>到这步还出现了个小问题，就是 fbtft 里面提供的 st7735 驱动是 160x128 分辨率的，而我的屏幕是 160x80 分辨率的，虽然已经在 fbtft_device.ko 的参数里制定了自定义的分辨率，但是屏幕的内容就显示不全，上面内容的冒到屏幕外了，下面还有一点屏幕空白，这应该是显示区域的起点错了，导致显示区域偏屏幕上方，看了下 st7735 的手册，发现这个芯片工作的逻辑是先发送要刷新区域的位置，然后再发送显示的内容：</p>
<figure>
<img src="https://pic.zhouyuqian.com/img/20210727233731.png" alt="y"><figcaption aria-hidden="true">y</figcaption>
</figure>
<figure>
<img src="https://pic.zhouyuqian.com/img/20210727233732.png" alt="y1"><figcaption aria-hidden="true">y1</figcaption>
</figure>
<p>然后就在驱动代码里找啊找，在 <em>linux-xlnx/drivers/staging/fbtft/fb_st7735r.c</em> 文件里找到了 <code>static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)</code> 这个函数，这应该就是发送显示区域的函数了，给 <code>ys</code> 和 <code>ye</code> 加了一个偏移，完美，显示区域到了屏幕中央了：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">static</span> <span class="keyword">void</span> <span class="title">set_addr_win</span><span class="params">(struct fbtft_par *par, <span class="keyword">int</span> xs, <span class="keyword">int</span> ys, <span class="keyword">int</span> xe, <span class="keyword">int</span> ye)</span></span></span><br><span class="line"><span class="function"></span>&#123;	</span><br><span class="line">trueys += <span class="number">0x18</span>; <span class="comment">// (128-80)/2</span></span><br><span class="line">trueye += <span class="number">0x18</span>;</span><br><span class="line"></span><br><span class="line">truewrite_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,</span><br><span class="line">truetrue  xs &gt;&gt; <span class="number">8</span>, xs &amp; <span class="number">0xFF</span>, xe &gt;&gt; <span class="number">8</span>, xe &amp; <span class="number">0xFF</span>);</span><br><span class="line"></span><br><span class="line">truewrite_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,</span><br><span class="line">truetrue  ys &gt;&gt; <span class="number">8</span>, ys &amp; <span class="number">0xFF</span>, ye &gt;&gt; <span class="number">8</span>, ye &amp; <span class="number">0xFF</span>);</span><br><span class="line"></span><br><span class="line">truewrite_reg(par, MIPI_DCS_WRITE_MEMORY_START);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h1 id="开机自动加载驱动">开机自动加载驱动</h1>
<blockquote>
<p>ref:</p>
<p>https://blog.csdn.net/hunanchenxingyu/article/details/47292327</p>
<p>http://www.waveshare.net/wiki/1.3inch_LCD_HAT</p>
</blockquote>
<h2 id="将驱动放到-rootfs-的内核目录下">将驱动放到 rootfs 的内核目录下</h2>
<p>将 <em>fbtft_device.ko</em>、<em>fb_st7735r.ko</em> 放到 <em>/lib/modules/<code>uname -r</code>/</em> 对应目录下：</p>
<p>具体在 <code>/lib/modules/&lt;uname -r&gt;/kernel/drivers/staging/fbtft/</code></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">xilinx@pynq:/lib/modules/4.14.0-xilinx-00001-gbba05abe65f5-dirty/kernel/drivers/staging/fbtft$ ls</span><br><span class="line">fb_ili9486.ko  fb_st7735r.ko  fb_st7789v.ko  fbtft_device.ko  flexfb.ko</span><br></pre></td></tr></table></figure>
<blockquote>
<p>tips:</p>
<p><code>uname -r</code> 命令可以用来查看内核版本号</p>
</blockquote>
<p>之后在生成 map 文件：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo depmod -A</span><br></pre></td></tr></table></figure>
<blockquote>
<p>这步目的是为了生成一个引索，这样内核可以找到之前拷贝过来的驱动</p>
</blockquote>
<p>可以用 <code>modprobe</code> 命令测试是否可以加载，用法（在任意目录下执行）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">modprobe xxx.ko        <span class="comment">#加载某个模块</span></span><br><span class="line">modprobe -r xxx.ko     <span class="comment">#卸载某个模块</span></span><br></pre></td></tr></table></figure>
<h2 id="启用模块">启用模块</h2>
<p>编辑文件 <em>/etc/modules</em>，添加如下：</p>
<figure class="highlight asciidoc"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">fb_st7735r</span><br><span class="line">fbtft_device</span><br></pre></td></tr></table></figure>
<h2 id="新建配置文件配置-fbtft">新建配置文件，配置 fbtft</h2>
<p>新建配置文件 <em>/etc/modprobe.d/fbtft.conf</em>，内容如下：</p>
<figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">options fbtft_device <span class="attribute">name</span>=adafruit18 <span class="attribute">busnum</span>=1 <span class="attribute">gpios</span>=reset:1014,dc:1015 <span class="attribute">rotate</span>=90 <span class="attribute">custom</span>=1 <span class="attribute">height</span>=160 <span class="attribute">width</span>=80</span><br></pre></td></tr></table></figure>
<p>上面 3 步完成后重启，应该就可以看到屏幕被点亮并显示了 console，说明驱动被自动加载了</p>
<h1 id="使用">使用</h1>
<blockquote>
<p>ref: https://github.com/notro/fbtft/wiki/Framebuffer-use</p>
</blockquote>
<ol type="1">
<li><p>显示图像化界面</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">FRAMEBUFFER=/dev/fb0 startx</span><br></pre></td></tr></table></figure></li>
<li><p>播放视频</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mplayer -vo fbdev:/dev/fb0 -zoom -x 160 -y 80 -nosound test.mp4</span><br></pre></td></tr></table></figure>
<div style="position: relative; width: 100%; height: 0; padding-bottom: 75%;">
<p><iframe src="//player.bilibili.com/player.html?aid=243218293&bvid=BV1ae411W731&cid=189943254&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"></iframe></p>
</div></li>
</ol>

    </div>

    
    
    

    <div>
      
        <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------The end of this article&nbsp;<i class="fa fa-paw"></i>&nbsp;Thank you for your reading-------</div>
    
</div>
      
    </div>
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>Fitz
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://zhouyuqian.com/2020/05/11/ZYNQ-%E7%A7%BB%E6%A4%8D-Linux-Frame-Buffer/" title="ZYNQ 移植 Linux -- Frame Buffer">https://zhouyuqian.com/2020/05/11/ZYNQ-移植-Linux-Frame-Buffer/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/zh" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/FPGA/" <i class="fa fa-tag"></i> FPGA</a>
              <a href="/tags/ZYNQ/" <i class="fa fa-tag"></i> ZYNQ</a>
              <a href="/tags/Linux/" <i class="fa fa-tag"></i> Linux</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/05/06/ZYNQ-%E7%A7%BB%E6%A4%8D-Linux-AXI-GPIO/" rel="prev" title="ZYNQ 移植 Linux -- AXI-GPIO">
      <i class="fa fa-chevron-left"></i> ZYNQ 移植 Linux -- AXI-GPIO
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/07/01/%E8%A7%A3%E5%86%B3-Altium-Designer-%E5%8D%A1%E6%AD%BB%E9%97%AE%E9%A2%98/" rel="next" title="解决 Altium Designer 卡死问题">
      解决 Altium Designer 卡死问题 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BF%AE%E6%94%B9-vivado-%E5%B7%A5%E7%A8%8B"><span class="nav-number">1.</span> <span class="nav-text">修改 Vivado 工程</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E9%87%8D%E6%96%B0%E7%94%9F%E6%88%90-boot.bin"><span class="nav-number">2.</span> <span class="nav-text">重新生成 BOOT.bin</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E9%85%8D%E7%BD%AE%E5%86%85%E6%A0%B8"><span class="nav-number">3.</span> <span class="nav-text">配置内核</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%8A%A0%E8%BD%BD%E9%A9%B1%E5%8A%A8"><span class="nav-number">4.</span> <span class="nav-text">加载驱动</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%B5%8B%E8%AF%95-gpio"><span class="nav-number">4.1.</span> <span class="nav-text">测试 GPIO</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%8A%A0%E8%BD%BD-fbtft-%E9%A9%B1%E5%8A%A8"><span class="nav-number">4.2.</span> <span class="nav-text">加载 fbtft 驱动</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%BC%80%E6%9C%BA%E8%87%AA%E5%8A%A8%E5%8A%A0%E8%BD%BD%E9%A9%B1%E5%8A%A8"><span class="nav-number">5.</span> <span class="nav-text">开机自动加载驱动</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%B0%86%E9%A9%B1%E5%8A%A8%E6%94%BE%E5%88%B0-rootfs-%E7%9A%84%E5%86%85%E6%A0%B8%E7%9B%AE%E5%BD%95%E4%B8%8B"><span class="nav-number">5.1.</span> <span class="nav-text">将驱动放到 rootfs 的内核目录下</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%90%AF%E7%94%A8%E6%A8%A1%E5%9D%97"><span class="nav-number">5.2.</span> <span class="nav-text">启用模块</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%96%B0%E5%BB%BA%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E9%85%8D%E7%BD%AE-fbtft"><span class="nav-number">5.3.</span> <span class="nav-text">新建配置文件，配置 fbtft</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8"><span class="nav-number">6.</span> <span class="nav-text">使用</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Fitz"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">Fitz</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">78</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">25</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">52</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/Starrynightzyq" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;Starrynightzyq" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:starrynightzyq@gmail.com" title="E-Mail → mailto:starrynightzyq@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://space.bilibili.com/57711842" title="Bilibili → https:&#x2F;&#x2F;space.bilibili.com&#x2F;57711842" rel="noopener" target="_blank"><i class="fa fa-fw fa-custom bilibili"></i>Bilibili</a>
      </span>
      <span class="links-of-author-item">
        <a href="http://wpa.qq.com/msgrd?v=3&uin=2421854978&site=qq&menu=yes" title="QQ → http:&#x2F;&#x2F;wpa.qq.com&#x2F;msgrd?v&#x3D;3&amp;uin&#x3D;2421854978&amp;site&#x3D;qq&amp;menu&#x3D;yes" rel="noopener" target="_blank"><i class="fa fa-fw fa-custom qq"></i>QQ</a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://leiblog.wang/" title="http:&#x2F;&#x2F;leiblog.wang" rel="noopener" target="_blank">Lei Blog</a>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        
  <div class="beian"><a href="http://beian.miit.gov.cn/" rel="noopener" target="_blank">苏ICP备20042287号 </a>
  </div>

<div class="copyright">
  
  &copy; 2018 – 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Fitz</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    <span title="站点总字数">251k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">3:48</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v5.3.0
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://mist.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> v7.7.2
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/theme-next/theme-next-pjax@0/pjax.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>

<script src="/js/bookmark.js"></script>

  <script>
var pjax = new Pjax({
  selectors: [
    'head title',
    '#page-configurations',
    '.content-wrap',
    '.post-toc-wrap',
    '#pjax'
  ],
  switches: {
    '.post-toc-wrap': Pjax.switches.innerHTML
  },
  analytics: false,
  cacheBust: false,
  scrollTo : !CONFIG.bookmark.enable
});

window.addEventListener('pjax:success', () => {
  document.querySelectorAll('script[pjax], script#page-configurations, #pjax script').forEach(element => {
    var code = element.text || element.textContent || element.innerHTML || '';
    var parent = element.parentNode;
    parent.removeChild(element);
    var script = document.createElement('script');
    if (element.id) {
      script.id = element.id;
    }
    if (element.className) {
      script.className = element.className;
    }
    if (element.type) {
      script.type = element.type;
    }
    if (element.src) {
      script.src = element.src;
      // Force synchronous loading of peripheral JS.
      script.async = false;
    }
    if (element.getAttribute('pjax') !== null) {
      script.setAttribute('pjax', '');
    }
    if (code !== '') {
      script.appendChild(document.createTextNode(code));
    }
    parent.appendChild(script);
  });
  NexT.boot.refresh();
  // Define Motion Sequence & Bootstrap Motion.
  if (CONFIG.motion.enable) {
    NexT.motion.integrator
      .init()
      .add(NexT.motion.middleWares.subMenu)
      .add(NexT.motion.middleWares.postList)
      .bootstrap();
  }
  NexT.utils.updateSidebarPosition();
});
</script>




  




  
<script src="/js/local-search.js"></script>













    <div id="pjax">
  

  
      

<script>
  if (typeof MathJax === 'undefined') {
    window.MathJax = {
      loader: {
        source: {
          '[tex]/amsCd': '[tex]/amscd',
          '[tex]/AMScd': '[tex]/amscd'
        }
      },
      tex: {
        inlineMath: {'[+]': [['$', '$']]},
        tags: 'ams'
      },
      options: {
        renderActions: {
          findScript: [10, doc => {
            document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
              const display = !!node.type.match(/; *mode=display/);
              const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
              const text = document.createTextNode('');
              node.parentNode.replaceChild(text, node);
              math.start = {node: text, delim: '', n: 0};
              math.end = {node: text, delim: '', n: 0};
              doc.math.push(math);
            });
          }, '', false],
          insertedScript: [200, () => {
            document.querySelectorAll('mjx-container').forEach(node => {
              let target = node.parentNode;
              if (target.nodeName.toLowerCase() === 'li') {
                target.parentNode.classList.add('has-jax');
              }
            });
          }, '', false]
        }
      }
    };
    (function () {
      var script = document.createElement('script');
      script.src = '//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
      script.defer = true;
      document.head.appendChild(script);
    })();
  } else {
    MathJax.startup.document.state(0);
    MathJax.texReset();
    MathJax.typeset();
  }
</script>

    

  

    </div>

  <!-- 页面点击小红心 -->
  <!-- <script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script> -->
  <script type="text/javascript" src="/js/clicklove.js"></script><!-- hexo-inject:begin --><!-- hexo-inject:end -->
</body>
</html>
